<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="点我" onclick="bmi()">
<script>
    function bmi(){
        var h = prompt('请输入身高');
        var weight  = prompt('请输入体重');

        var bmi = weight/(h*h);
        console.log(bmi);

    }
</script>

</body>
</html>